import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'
// import App from '../App.vue'
import FileDownload from '../views/FileDownload.vue'
import HomeworkUnload from '../views/HomeworkUnload.vue';
import ChangePwd from '../views/ChangePwd.vue'

import AdminHome from '../views/AdminHome.vue';
import AdminSeverSetting from '../views/AdminServerSetting.vue';
import AdminSignManage from '../views/AdminSignManage.vue';

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '*',
    redirect: '/login'
  },
  {
    path: '/adminhome',
    component: AdminHome,
    children: [
      {
        path: '/',
        redirect: '/serversetting'
      },
      {
        path: '/serversetting',
        name: 'AdminSeverSetting',
        component: AdminSeverSetting
      },
      {
        path: '/signmanage',
        name: 'AdminSignManage',
        component: AdminSignManage
      },
      {
        path: '/changepwd',
        name: 'ChangePwd',
        component: ChangePwd
      },
    ]
  },
  {
    path: '/home',
    // component: resolve => require(["../views/Home.vue"], resolve),
    component: Home,
    children: [
      {
        path: '/',
        redirect: '/filedownload'
      },
      {
        path: '/filedownload',
        name: 'FileDownload',
        component: FileDownload
      },
      {
        path: '/hwupload',
        name: 'HomeworkUnload',
        component: HomeworkUnload
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        // component: () => import(/* webpackChunkName: "about" */ '../views/HomeworkUnload.vue')
      },
      {
        path: '/changepwd',
        name: 'ChangePwd',
        component: ChangePwd
      },
    ]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// router.beforeEach((to, from, next) => {
//   next(false);
// })
export default router


